import java.util.Scanner;

public class zuoye5 {
    //    用户输入整数n，计算1!+(1!+2!)+(1!+2!+3!)+…..+(1!+2!+…n!)
//    用方法实现
    //         有参数有返回值
    public static void main(String[] args) {
        System.out.println(zhengshu(5));
    }

    public static double zhengshu(double n) {
        Scanner scanner = new Scanner(System.in);
        if (n == 1) {
            return 1;
        }
        return  n * zhengshu(n-1);
    }
}
